// Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
// SPDX-License-Identifier: Apache-2.0
#include "stdafx.h"

#include "PRTIconMesh.hpp"

#include <frantic/geometry/trimesh3.hpp>
#include <frantic/graphics/vector3.hpp>
#include <frantic/graphics/vector3f.hpp>

#include <maya/M3dView.h>

using namespace frantic::geometry;
using namespace frantic::graphics;

namespace {

float baseVertices[] = {
    -0.138722f,   0.0f, -0.232087f,   -0.136268f,   0.0f, -0.232837f,   -0.134571f,   0.0f, -0.234661f,
    -0.13399f,    0.0f, -0.237165f,   -0.134883f,   0.0f, -0.240047f,   -0.13703f,    0.0f, -0.242048f,
    -0.139968f,   0.0f, -0.24273f,    -0.143385f,   0.0f, -0.241666f,   -0.145757f,   0.0f, -0.239122f,
    -0.146575f,   0.0f, -0.235643f,   -0.145303f,   0.0f, -0.231545f,   -0.142255f,   0.0f, -0.228704f,
    -0.138086f,   0.0f, -0.227716f,   -0.133148f,   0.0f, -0.229255f,   -0.129722f,   0.0f, -0.232929f,
    -0.128545f,   0.0f, -0.237959f,   -0.130393f,   0.0f, -0.243961f,   -0.134851f,   0.0f, -0.248117f,
    -0.140964f,   0.0f, -0.249544f,   -0.148275f,   0.0f, -0.24728f,    -0.153345f,   0.0f, -0.241841f,
    -0.155091f,   0.0f, -0.234383f,   -0.152319f,   0.0f, -0.225426f,   -0.145658f,   0.0f, -0.219213f,
    -0.13653f,    0.0f, -0.217076f,   -0.125503f,   0.0f, -0.220487f,   -0.117867f,   0.0f, -0.228681f,
    -0.115243f,   0.0f, -0.239912f,   -0.119443f,   0.0f, -0.253509f,   -0.129549f,   0.0f, -0.262924f,
    -0.143405f,   0.0f, -0.266154f,   -0.160217f,   0.0f, -0.260963f,   -0.171864f,   0.0f, -0.248468f,
    -0.175863f,   0.0f, -0.231328f,   -0.169428f,   0.0f, -0.210496f,   -0.153945f,   0.0f, -0.196067f,
    -0.132709f,   0.0f, -0.191109f,   -0.106844f,   0.0f, -0.199099f,   -0.0889302f,  0.0f, -0.218317f,
    -0.0827816f,  0.0f, -0.244681f,   -0.0927072f,  0.0f, -0.276835f,   -0.116597f,   0.0f, -0.299105f,
    -0.149366f,   0.0f, -0.306747f,   -0.18535f,    0.0f, -0.293808f,   -0.205267f,   0.0f, -0.263037f,
    -0.210556f,   0.0f, -0.221795f,   -0.209107f,   0.0f, -0.221842f,   -0.203928f,   0.0f, -0.262425f,
    -0.184449f,   0.0f, -0.292623f,   -0.149314f,   0.0f, -0.305298f,   -0.11728f,    0.0f, -0.29783f,
    -0.0939315f,  0.0f, -0.276063f,   -0.0842314f,  0.0f, -0.24463f,    -0.0902056f,  0.0f, -0.219001f,
    -0.107615f,   0.0f, -0.200324f,   -0.13276f,    0.0f, -0.192559f,   -0.153261f,   0.0f, -0.197343f,
    -0.168204f,   0.0f, -0.211268f,   -0.174414f,   0.0f, -0.23138f,    -0.170589f,   0.0f, -0.247783f,
    -0.159446f,   0.0f, -0.259739f,   -0.143355f,   0.0f, -0.264705f,   -0.130232f,   0.0f, -0.261648f,
    -0.120667f,   0.0f, -0.252737f,   -0.116693f,   0.0f, -0.239861f,   -0.119142f,   0.0f, -0.229365f,
    -0.126275f,   0.0f, -0.221711f,   -0.136581f,   0.0f, -0.218526f,   -0.144973f,   0.0f, -0.220488f,
    -0.151095f,   0.0f, -0.226197f,   -0.153641f,   0.0f, -0.234434f,   -0.15207f,    0.0f, -0.241157f,
    -0.147503f,   0.0f, -0.246056f,   -0.140912f,   0.0f, -0.248094f,   -0.135535f,   0.0f, -0.24684f,
    -0.131618f,   0.0f, -0.243188f,   -0.129995f,   0.0f, -0.237908f,   -0.130997f,   0.0f, -0.233613f,
    -0.133918f,   0.0f, -0.230479f,   -0.138137f,   0.0f, -0.229166f,   -0.141573f,   0.0f, -0.229978f,
    -0.14408f,    0.0f, -0.232316f,   -0.145124f,   0.0f, -0.235694f,   -0.144482f,   0.0f, -0.23844f,
    -0.142612f,   0.0f, -0.240443f,   -0.139912f,   0.0f, -0.241281f,   -0.137712f,   0.0f, -0.240771f,
    -0.136107f,   0.0f, -0.239274f,   -0.13544f,    0.0f, -0.237114f,   -0.135849f,   0.0f, -0.235346f,
    -0.137047f,   0.0f, -0.234063f,   -0.138778f,   0.0f, -0.233537f,   -0.157261f,   0.0f, -0.343195f,
    -0.158018f,   0.0f, -0.345644f,   -0.159839f,   0.0f, -0.347338f,   -0.162341f,   0.0f, -0.347909f,
    -0.16522f,    0.0f, -0.347026f,   -0.167219f,   0.0f, -0.344888f,   -0.16791f,    0.0f, -0.341948f,
    -0.166846f,   0.0f, -0.338526f,   -0.164298f,   0.0f, -0.336153f,   -0.160816f,   0.0f, -0.335336f,
    -0.15672f,    0.0f, -0.336607f,   -0.153878f,   0.0f, -0.339653f,   -0.152901f,   0.0f, -0.343832f,
    -0.15443f,    0.0f, -0.348768f,   -0.158101f,   0.0f, -0.352188f,   -0.163137f,   0.0f, -0.35336f,
    -0.169133f,   0.0f, -0.351515f,   -0.173285f,   0.0f, -0.347058f,   -0.174717f,   0.0f, -0.340948f,
    -0.172454f,   0.0f, -0.33364f,    -0.16702f,    0.0f, -0.328575f,   -0.159569f,   0.0f, -0.326831f,
    -0.150609f,   0.0f, -0.329599f,   -0.144396f,   0.0f, -0.336258f,   -0.142261f,   0.0f, -0.345387f,
    -0.145667f,   0.0f, -0.356407f,   -0.153857f,   0.0f, -0.364041f,   -0.165093f,   0.0f, -0.366656f,
    -0.178686f,   0.0f, -0.362458f,   -0.188101f,   0.0f, -0.352358f,   -0.191333f,   0.0f, -0.338507f,
    -0.186145f,   0.0f, -0.321693f,   -0.173647f,   0.0f, -0.310047f,   -0.156503f,   0.0f, -0.306042f,
    -0.135673f,   0.0f, -0.312484f,   -0.121244f,   0.0f, -0.327971f,   -0.116288f,   0.0f, -0.349213f,
    -0.124277f,   0.0f, -0.375074f,   -0.143498f,   0.0f, -0.392982f,   -0.169859f,   0.0f, -0.39913f,
    -0.202015f,   0.0f, -0.38921f,    -0.224283f,   0.0f, -0.36532f,    -0.231926f,   0.0f, -0.332551f,
    -0.230477f,   0.0f, -0.332596f,   -0.223008f,   0.0f, -0.364633f,   -0.201243f,   0.0f, -0.387982f,
    -0.16981f,    0.0f, -0.397681f,   -0.144181f,   0.0f, -0.391707f,   -0.125502f,   0.0f, -0.374301f,
    -0.117738f,   0.0f, -0.349163f,   -0.122519f,   0.0f, -0.328655f,   -0.136444f,   0.0f, -0.313708f,
    -0.156553f,   0.0f, -0.307492f,   -0.172962f,   0.0f, -0.311322f,   -0.18492f,    0.0f, -0.322465f,
    -0.189884f,   0.0f, -0.338558f,   -0.186825f,   0.0f, -0.351673f,   -0.177913f,   0.0f, -0.361234f,
    -0.16504f,    0.0f, -0.365207f,   -0.154541f,   0.0f, -0.362764f,   -0.146891f,   0.0f, -0.355635f,
    -0.143712f,   0.0f, -0.345336f,   -0.145671f,   0.0f, -0.336943f,   -0.151379f,   0.0f, -0.330823f,
    -0.159618f,   0.0f, -0.328282f,   -0.166336f,   0.0f, -0.32985f,    -0.171231f,   0.0f, -0.334412f,
    -0.173267f,   0.0f, -0.340999f,   -0.17201f,    0.0f, -0.346373f,   -0.168359f,   0.0f, -0.35029f,
    -0.163088f,   0.0f, -0.35191f,    -0.158786f,   0.0f, -0.350913f,   -0.155654f,   0.0f, -0.347995f,
    -0.15435f,    0.0f, -0.34378f,    -0.155153f,   0.0f, -0.340337f,   -0.157492f,   0.0f, -0.337829f,
    -0.160869f,   0.0f, -0.336786f,   -0.163616f,   0.0f, -0.337428f,   -0.165624f,   0.0f, -0.339297f,
    -0.166459f,   0.0f, -0.341998f,   -0.165943f,   0.0f, -0.344202f,   -0.164446f,   0.0f, -0.3458f,
    -0.162287f,   0.0f, -0.34646f,    -0.160525f,   0.0f, -0.346057f,   -0.159243f,   0.0f, -0.344862f,
    -0.15871f,    0.0f, -0.343133f,   -0.350877f,   0.0f, -0.203353f,   -0.351908f,   0.0f, -0.203587f,
    -0.35266f,    0.0f, -0.204274f,   -0.352972f,   0.0f, -0.20527f,    -0.352629f,   0.0f, -0.206745f,
    -0.351634f,   0.0f, -0.207814f,   -0.350197f,   0.0f, -0.208254f,   -0.348183f,   0.0f, -0.20779f,
    -0.346718f,   0.0f, -0.206423f,   -0.346112f,   0.0f, -0.204441f,   -0.346736f,   0.0f, -0.201742f,
    -0.348568f,   0.0f, -0.199777f,   -0.351227f,   0.0f, -0.19896f,    -0.354788f,   0.0f, -0.199784f,
    -0.357381f,   0.0f, -0.202201f,   -0.358456f,   0.0f, -0.205701f,   -0.35738f,    0.0f, -0.210338f,
    -0.354231f,   0.0f, -0.213712f,   -0.349675f,   0.0f, -0.215113f,   -0.343697f,   0.0f, -0.213725f,
    -0.339341f,   0.0f, -0.209667f,   -0.337528f,   0.0f, -0.203793f,   -0.33931f,    0.0f, -0.196128f,
    -0.344511f,   0.0f, -0.190546f,   -0.352026f,   0.0f, -0.188229f,   -0.361795f,   0.0f, -0.190505f,
    -0.368906f,   0.0f, -0.197134f,   -0.371859f,   0.0f, -0.206713f,   -0.368976f,   0.0f, -0.219097f,
    -0.360565f,   0.0f, -0.228122f,   -0.34841f,    0.0f, -0.231872f,   -0.332744f,   0.0f, -0.228221f,
    -0.321329f,   0.0f, -0.21758f,    -0.316584f,   0.0f, -0.202204f,   -0.321191f,   0.0f, -0.182438f,
    -0.334613f,   0.0f, -0.168035f,   -0.354006f,   0.0f, -0.162057f,   -0.378903f,   0.0f, -0.167856f,
    -0.397043f,   0.0f, -0.184761f,   -0.404578f,   0.0f, -0.209188f,   -0.397286f,   0.0f, -0.240488f,
    -0.376027f,   0.0f, -0.263301f,   -0.345322f,   0.0f, -0.272782f,   -0.31025f,    0.0f, -0.262815f,
    -0.289172f,   0.0f, -0.234602f,   -0.281311f,   0.0f, -0.195127f,   -0.279862f,   0.0f, -0.195181f,
    -0.287881f,   0.0f, -0.235307f,   -0.309436f,   0.0f, -0.26406f,    -0.345372f,   0.0f, -0.274231f,
    -0.376799f,   0.0f, -0.264526f,   -0.398561f,   0.0f, -0.241172f,   -0.406027f,   0.0f, -0.209137f,
    -0.398267f,   0.0f, -0.183989f,   -0.379588f,   0.0f, -0.166581f,   -0.353957f,   0.0f, -0.160608f,
    -0.333842f,   0.0f, -0.166811f,   -0.319916f,   0.0f, -0.181754f,   -0.315134f,   0.0f, -0.202256f,
    -0.320105f,   0.0f, -0.218352f,   -0.33206f,    0.0f, -0.229496f,   -0.34846f,    0.0f, -0.233321f,
    -0.361337f,   0.0f, -0.229346f,   -0.370251f,   0.0f, -0.21978f,    -0.37331f,    0.0f, -0.206662f,
    -0.370132f,   0.0f, -0.196362f,   -0.36248f,    0.0f, -0.189229f,   -0.351975f,   0.0f, -0.18678f,
    -0.343739f,   0.0f, -0.189322f,   -0.338034f,   0.0f, -0.195444f,   -0.336079f,   0.0f, -0.203845f,
    -0.338117f,   0.0f, -0.21044f,    -0.343014f,   0.0f, -0.215001f,   -0.349725f,   0.0f, -0.216563f,
    -0.355002f,   0.0f, -0.214937f,   -0.358655f,   0.0f, -0.211023f,   -0.359905f,   0.0f, -0.20565f,
    -0.358606f,   0.0f, -0.201428f,   -0.355471f,   0.0f, -0.198507f,   -0.351174f,   0.0f, -0.19751f,
    -0.347795f,   0.0f, -0.198553f,   -0.345459f,   0.0f, -0.201057f,   -0.344661f,   0.0f, -0.204492f,
    -0.345493f,   0.0f, -0.207196f,   -0.347497f,   0.0f, -0.209067f,   -0.350249f,   0.0f, -0.209704f,
    -0.352407f,   0.0f, -0.209038f,   -0.353904f,   0.0f, -0.207429f,   -0.354421f,   0.0f, -0.205219f,
    -0.353886f,   0.0f, -0.203502f,   -0.3526f,     0.0f, -0.202311f,   -0.350839f,   0.0f, -0.201903f,
    -0.336984f,   0.0f, -0.312687f,   -0.336749f,   0.0f, -0.313711f,   -0.336058f,   0.0f, -0.314461f,
    -0.335052f,   0.0f, -0.314774f,   -0.333584f,   0.0f, -0.314433f,   -0.332519f,   0.0f, -0.313443f,
    -0.332078f,   0.0f, -0.312005f,   -0.332545f,   0.0f, -0.309986f,   -0.33391f,    0.0f, -0.308519f,
    -0.335891f,   0.0f, -0.307909f,   -0.338598f,   0.0f, -0.30854f,    -0.340564f,   0.0f, -0.310375f,
    -0.341379f,   0.0f, -0.313028f,   -0.340552f,   0.0f, -0.316587f,   -0.338135f,   0.0f, -0.319178f,
    -0.334635f,   0.0f, -0.320257f,   -0.329993f,   0.0f, -0.319178f,   -0.326618f,   0.0f, -0.31603f,
    -0.325214f,   0.0f, -0.311483f,   -0.326609f,   0.0f, -0.305496f,   -0.330669f,   0.0f, -0.30114f,
    -0.33654f,    0.0f, -0.299324f,   -0.344203f,   0.0f, -0.30111f,    -0.349785f,   0.0f, -0.306313f,
    -0.352103f,   0.0f, -0.313833f,   -0.349831f,   0.0f, -0.323595f,   -0.343202f,   0.0f, -0.330704f,
    -0.33362f,    0.0f, -0.333656f,   -0.321235f,   0.0f, -0.330772f,   -0.312211f,   0.0f, -0.322365f,
    -0.30846f,    0.0f, -0.310211f,   -0.31211f,    0.0f, -0.294548f,   -0.322749f,   0.0f, -0.28313f,
    -0.338122f,   0.0f, -0.278387f,   -0.357892f,   0.0f, -0.282997f,   -0.372295f,   0.0f, -0.296422f,
    -0.378275f,   0.0f, -0.31582f,    -0.37248f,    0.0f, -0.340709f,   -0.355578f,   0.0f, -0.358845f,
    -0.331157f,   0.0f, -0.366379f,   -0.299849f,   0.0f, -0.359086f,   -0.277037f,   0.0f, -0.337822f,
    -0.267561f,   0.0f, -0.307117f,   -0.266111f,   0.0f, -0.307175f,   -0.275812f,   0.0f, -0.3386f,
    -0.299165f,   0.0f, -0.360362f,   -0.331208f,   0.0f, -0.36783f,    -0.35635f,    0.0f, -0.360069f,
    -0.373755f,   0.0f, -0.341392f,   -0.379724f,   0.0f, -0.315769f,   -0.373519f,   0.0f, -0.295649f,
    -0.358575f,   0.0f, -0.28172f,    -0.338072f,   0.0f, -0.276938f,   -0.321976f,   0.0f, -0.281906f,
    -0.310834f,   0.0f, -0.293863f,   -0.307011f,   0.0f, -0.310262f,   -0.310987f,   0.0f, -0.323137f,
    -0.32055f,    0.0f, -0.332049f,   -0.333671f,   0.0f, -0.335105f,   -0.343974f,   0.0f, -0.331928f,
    -0.351106f,   0.0f, -0.324278f,   -0.353552f,   0.0f, -0.313782f,   -0.351009f,   0.0f, -0.30554f,
    -0.344885f,   0.0f, -0.299833f,   -0.336488f,   0.0f, -0.297875f,   -0.329898f,   0.0f, -0.299918f,
    -0.325334f,   0.0f, -0.304813f,   -0.323765f,   0.0f, -0.311534f,   -0.325394f,   0.0f, -0.316801f,
    -0.32931f,    0.0f, -0.320453f,   -0.334687f,   0.0f, -0.321708f,   -0.338909f,   0.0f, -0.320402f,
    -0.341829f,   0.0f, -0.317271f,   -0.342828f,   0.0f, -0.312976f,   -0.341786f,   0.0f, -0.309603f,
    -0.33928f,    0.0f, -0.307265f,   -0.335839f,   0.0f, -0.306458f,   -0.333138f,   0.0f, -0.307297f,
    -0.33127f,    0.0f, -0.309303f,   -0.330627f,   0.0f, -0.312056f,   -0.331295f,   0.0f, -0.314214f,
    -0.332899f,   0.0f, -0.315708f,   -0.335102f,   0.0f, -0.316223f,   -0.336828f,   0.0f, -0.315687f,
    -0.338025f,   0.0f, -0.314401f,   -0.338434f,   0.0f, -0.312646f,   -0.293706f,   0.0f, -0.399395f,
    -0.293946f,   0.0f, -0.398361f,   -0.294639f,   0.0f, -0.397607f,   -0.295649f,   0.0f, -0.397291f,
    -0.297117f,   0.0f, -0.39763f,    -0.298178f,   0.0f, -0.398622f,   -0.298618f,   0.0f, -0.400058f,
    -0.298149f,   0.0f, -0.402083f,   -0.296784f,   0.0f, -0.40355f,    -0.294804f,   0.0f, -0.404156f,
    -0.292101f,   0.0f, -0.403531f,   -0.290134f,   0.0f, -0.401696f,   -0.289317f,   0.0f, -0.399037f,
    -0.290144f,   0.0f, -0.395474f,   -0.292558f,   0.0f, -0.392881f,   -0.296053f,   0.0f, -0.391806f,
    -0.300697f,   0.0f, -0.392885f,   -0.304075f,   0.0f, -0.396032f,   -0.305476f,   0.0f, -0.400582f,
    -0.304089f,   0.0f, -0.406561f,   -0.300029f,   0.0f, -0.41092f,    -0.294156f,   0.0f, -0.412739f,
    -0.286491f,   0.0f, -0.410955f,   -0.28091f,    0.0f, -0.405752f,   -0.278593f,   0.0f, -0.398231f,
    -0.280865f,   0.0f, -0.38847f,    -0.287492f,   0.0f, -0.381359f,   -0.29707f,    0.0f, -0.378407f,
    -0.309459f,   0.0f, -0.381291f,   -0.318482f,   0.0f, -0.389698f,   -0.322229f,   0.0f, -0.401853f,
    -0.318583f,   0.0f, -0.417522f,   -0.307945f,   0.0f, -0.428936f,   -0.292568f,   0.0f, -0.433676f,
    -0.272802f,   0.0f, -0.429071f,   -0.258398f,   0.0f, -0.415644f,   -0.252415f,   0.0f, -0.396249f,
    -0.250966f,   0.0f, -0.396306f,   -0.257174f,   0.0f, -0.416421f,   -0.272118f,   0.0f, -0.430349f,
    -0.292618f,   0.0f, -0.435127f,   -0.308717f,   0.0f, -0.43016f,    -0.31986f,    0.0f, -0.418205f,
    -0.323679f,   0.0f, -0.401802f,   -0.319706f,   0.0f, -0.388927f,   -0.310143f,   0.0f, -0.380016f,
    -0.297019f,   0.0f, -0.376958f,   -0.28672f,    0.0f, -0.380135f,   -0.279588f,   0.0f, -0.387785f,
    -0.277144f,   0.0f, -0.398281f,   -0.279685f,   0.0f, -0.406523f,   -0.285808f,   0.0f, -0.41223f,
    -0.294208f,   0.0f, -0.41419f,    -0.300802f,   0.0f, -0.412144f,   -0.305366f,   0.0f, -0.407246f,
    -0.306925f,   0.0f, -0.40053f,    -0.305299f,   0.0f, -0.395258f,   -0.301381f,   0.0f, -0.391609f,
    -0.296003f,   0.0f, -0.390357f,   -0.291786f,   0.0f, -0.391657f,   -0.288867f,   0.0f, -0.394791f,
    -0.287868f,   0.0f, -0.399088f,   -0.288908f,   0.0f, -0.402468f,   -0.291416f,   0.0f, -0.404806f,
    -0.294857f,   0.0f, -0.405605f,   -0.297558f,   0.0f, -0.404774f,   -0.299426f,   0.0f, -0.402768f,
    -0.300068f,   0.0f, -0.400008f,   -0.299401f,   0.0f, -0.397851f,   -0.297797f,   0.0f, -0.396355f,
    -0.295593f,   0.0f, -0.39584f,    -0.293867f,   0.0f, -0.396383f,   -0.292672f,   0.0f, -0.397668f,
    -0.292256f,   0.0f, -0.399429f,   -0.370834f,   0.0f, -0.108347f,   -0.373146f,   0.0f, -0.110657f,
    -0.376398f,   0.0f, -0.111536f,   -0.379647f,   0.0f, -0.110657f,   -0.38196f,    0.0f, -0.108347f,
    -0.382842f,   0.0f, -0.105099f,   -0.38196f,    0.0f, -0.101845f,   -0.379647f,   0.0f, -0.099538f,
    -0.376398f,   0.0f, -0.0986613f,  -0.373146f,   0.0f, -0.0995381f,  -0.370834f,   0.0f, -0.101845f,
    -0.369955f,   0.0f, -0.105099f,   -0.480336f,   0.0f, -0.208195f,   -0.482647f,   0.0f, -0.210508f,
    -0.485899f,   0.0f, -0.211388f,   -0.48915f,    0.0f, -0.210508f,   -0.491462f,   0.0f, -0.208195f,
    -0.492343f,   0.0f, -0.204939f,   -0.491462f,   0.0f, -0.20169f,    -0.48915f,    0.0f, -0.19938f,
    -0.485899f,   0.0f, -0.1985f,     -0.482647f,   0.0f, -0.19938f,    -0.480336f,   0.0f, -0.20169f,
    -0.479456f,   0.0f, -0.204939f,   -0.34661f,    0.0f, -0.0415732f,  -0.352964f,   0.0f, -0.0479289f,
    -0.361903f,   0.0f, -0.0503488f,  -0.370843f,   0.0f, -0.0479289f,  -0.377197f,   0.0f, -0.041573f,
    -0.379617f,   0.0f, -0.0326359f,  -0.377197f,   0.0f, -0.0236933f,  -0.370844f,   0.0f, -0.01734f,
    -0.361903f,   0.0f, -0.014923f,   -0.352964f,   0.0f, -0.0173402f,  -0.34661f,    0.0f, -0.0236933f,
    -0.34419f,    0.0f, -0.0326359f,  -0.332188f,   0.0f, -0.0697018f,  -0.334499f,   0.0f, -0.0720091f,
    -0.337747f,   0.0f, -0.0728858f,  -0.341f,      0.0f, -0.0720091f,  -0.343311f,   0.0f, -0.0697018f,
    -0.34419f,    0.0f, -0.0664483f,  -0.343311f,   0.0f, -0.0632001f,  -0.341f,      0.0f, -0.0608902f,
    -0.337747f,   0.0f, -0.0600109f,  -0.334499f,   0.0f, -0.0608904f,  -0.332188f,   0.0f, -0.0632001f,
    -0.331309f,   0.0f, -0.0664483f,  -0.00733422f, 0.0f, -0.17439f,    -0.0107992f,  0.0f, -0.177856f,
    -0.0156787f,  0.0f, -0.179175f,   -0.0205531f,  0.0f, -0.177856f,   -0.0240213f,  0.0f, -0.17439f,
    -0.0253419f,  0.0f, -0.169513f,   -0.0240211f,  0.0f, -0.164636f,   -0.0205533f,  0.0f, -0.161169f,
    -0.0156787f,  0.0f, -0.15985f,    -0.0107992f,  0.0f, -0.161169f,   -0.00733437f, 0.0f, -0.164636f,
    -0.00601657f, 0.0f, -0.169513f,   -0.114691f,   0.0f, -0.0174826f,  -0.118158f,   0.0f, -0.0209486f,
    -0.123035f,   0.0f, -0.0222674f,  -0.127912f,   0.0f, -0.0209486f,  -0.131378f,   0.0f, -0.0174826f,
    -0.132697f,   0.0f, -0.0126053f,  -0.131378f,   0.0f, -0.00772908f, -0.127912f,   0.0f, -0.00426254f,
    -0.123035f,   0.0f, -0.0029434f,  -0.118158f,   0.0f, -0.00426269f, -0.114691f,   0.0f, -0.00772893f,
    -0.113372f,   0.0f, -0.0126053f,  0.0628633f,   0.0f, 0.0362009f,   0.0593953f,   0.0f, 0.0327349f,
    0.0545148f,   0.0f, 0.0314161f,   0.0496412f,   0.0f, 0.0327349f,   0.0461757f,   0.0f, 0.0362009f,
    0.0448567f,   0.0f, 0.0410782f,   0.0461758f,   0.0f, 0.0459459f,   0.049641f,    0.0f, 0.0494098f,
    0.0545148f,   0.0f, 0.0507284f,   0.0593955f,   0.0f, 0.0494098f,   0.0628632f,   0.0f, 0.0459459f,
    0.0641827f,   0.0f, 0.0410782f,   0.124797f,    0.0f, -0.166135f,   0.12133f,     0.0f, -0.169601f,
    0.116452f,    0.0f, -0.170921f,   0.11158f,     0.0f, -0.169601f,   0.108115f,    0.0f, -0.166135f,
    0.106796f,    0.0f, -0.161258f,   0.108115f,    0.0f, -0.156381f,   0.11158f,     0.0f, -0.152915f,
    0.116452f,    0.0f, -0.151595f,   0.12133f,     0.0f, -0.152915f,   0.124796f,    0.0f, -0.156381f,
    0.126116f,    0.0f, -0.161258f,   0.0566407f,   0.0f, -0.340271f,   0.0520201f,   0.0f, -0.344894f,
    0.0455157f,   0.0f, -0.346653f,   0.0390135f,   0.0f, -0.344895f,   0.0343893f,   0.0f, -0.340271f,
    0.0326289f,   0.0f, -0.333766f,   0.0343894f,   0.0f, -0.327269f,   0.0390135f,   0.0f, -0.322649f,
    0.0455157f,   0.0f, -0.32089f,    0.0520202f,   0.0f, -0.322649f,   0.0566407f,   0.0f, -0.327269f,
    0.0583985f,   0.0f, -0.333766f,   -0.0593055f,  0.0f, -0.404686f,   -0.063926f,   0.0f, -0.409308f,
    -0.0704298f,  0.0f, -0.411067f,   -0.0769324f,  0.0f, -0.409308f,   -0.0815569f,  0.0f, -0.404686f,
    -0.0833173f,  0.0f, -0.39818f,    -0.0815567f,  0.0f, -0.39168f,    -0.0769325f,  0.0f, -0.387054f,
    -0.0704298f,  0.0f, -0.385293f,   -0.063926f,   0.0f, -0.387054f,   -0.0593056f,  0.0f, -0.39168f,
    -0.0575478f,  0.0f, -0.39818f,    -0.141888f,   0.0f, -0.441978f,   -0.146511f,   0.0f, -0.446601f,
    -0.153015f,   0.0f, -0.44836f,    -0.159517f,   0.0f, -0.446601f,   -0.16414f,    0.0f, -0.441978f,
    -0.165898f,   0.0f, -0.435474f,   -0.164138f,   0.0f, -0.428974f,   -0.159517f,   0.0f, -0.424348f,
    -0.153015f,   0.0f, -0.422587f,   -0.146511f,   0.0f, -0.424348f,   -0.141888f,   0.0f, -0.428972f,
    -0.14013f,    0.0f, -0.435474f,   0.246667f,    0.0f, -0.382147f,   0.242045f,    0.0f, -0.38677f,
    0.235544f,    0.0f, -0.388529f,   0.22904f,     0.0f, -0.38677f,    0.224419f,    0.0f, -0.382147f,
    0.222663f,    0.0f, -0.375641f,   0.224419f,    0.0f, -0.369135f,   0.22904f,     0.0f, -0.364512f,
    0.235544f,    0.0f, -0.362754f,   0.242045f,    0.0f, -0.364514f,   0.246667f,    0.0f, -0.369135f,
    0.248426f,    0.0f, -0.375641f,   0.105607f,    0.0f, -0.378094f,   0.10272f,     0.0f, -0.380982f,
    0.0986545f,   0.0f, -0.38208f,    0.0945918f,   0.0f, -0.380982f,   0.0917031f,   0.0f, -0.378094f,
    0.0906036f,   0.0f, -0.374028f,   0.0917033f,   0.0f, -0.369964f,   0.0945919f,   0.0f, -0.367077f,
    0.0986545f,   0.0f, -0.365979f,   0.10272f,     0.0f, -0.367077f,   0.105607f,    0.0f, -0.369964f,
    0.106705f,    0.0f, -0.374028f,   0.27631f,     0.0f, -0.410298f,   0.273422f,    0.0f, -0.41319f,
    0.269358f,    0.0f, -0.414291f,   0.265298f,    0.0f, -0.41319f,    0.262407f,    0.0f, -0.410298f,
    0.261307f,    0.0f, -0.40623f,    0.262408f,    0.0f, -0.402173f,   0.265296f,    0.0f, -0.399288f,
    0.269358f,    0.0f, -0.398191f,   0.273422f,    0.0f, -0.399288f,   0.27631f,     0.0f, -0.402172f,
    0.277408f,    0.0f, -0.40623f,    0.386175f,    0.0f, -0.427606f,   0.383289f,    0.0f, -0.430495f,
    0.379227f,    0.0f, -0.431596f,   0.375167f,    0.0f, -0.430495f,   0.372282f,    0.0f, -0.427606f,
    0.371184f,    0.0f, -0.423546f,   0.372282f,    0.0f, -0.41948f,    0.375167f,    0.0f, -0.416593f,
    0.379227f,    0.0f, -0.415495f,   0.383289f,    0.0f, -0.416593f,   0.386174f,    0.0f, -0.41948f,
    0.387272f,    0.0f, -0.423546f,   0.0991681f,   0.0f, -0.310459f,   0.0962793f,   0.0f, -0.313343f,
    0.0922169f,   0.0f, -0.314441f,   0.0881561f,   0.0f, -0.313343f,   0.0852666f,   0.0f, -0.310459f,
    0.0841662f,   0.0f, -0.306402f,   0.0852667f,   0.0f, -0.302333f,   0.0881561f,   0.0f, -0.29944f,
    0.0922169f,   0.0f, -0.298339f,   0.0962795f,   0.0f, -0.29944f,    0.0991681f,   0.0f, -0.302333f,
    0.100268f,    0.0f, -0.306402f,   -0.0659696f,  0.0f, -0.0882626f,  -0.0711677f,  0.0f, -0.0934594f,
    -0.0784853f,  0.0f, -0.0954367f,  -0.0857985f,  0.0f, -0.0934595f,  -0.0909996f,  0.0f, -0.0882626f,
    -0.0929794f,  0.0f, -0.0809484f,  -0.0909994f,  0.0f, -0.0736312f,  -0.0857986f,  0.0f, -0.0684285f,
    -0.0784853f,  0.0f, -0.0664483f,  -0.0711677f,  0.0f, -0.0684286f,  -0.0659696f,  0.0f, -0.0736312f,
    -0.0639922f,  0.0f, -0.0809484f,  0.0868149f,   0.0f, -0.208009f,   0.0816151f,   0.0f, -0.213211f,
    0.0742993f,   0.0f, -0.215192f,   0.0669852f,   0.0f, -0.213212f,   0.0617881f,   0.0f, -0.208009f,
    0.0598112f,   0.0f, -0.200692f,   0.0617883f,   0.0f, -0.193378f,   0.0669851f,   0.0f, -0.188181f,
    0.0742993f,   0.0f, -0.186204f,   0.0816152f,   0.0f, -0.188181f,   0.0868149f,   0.0f, -0.193378f,
    0.0887936f,   0.0f, -0.200692f,   -0.113397f,   0.0f, -0.159085f,   -0.116284f,   0.0f, -0.161974f,
    -0.12035f,    0.0f, -0.163075f,   -0.124416f,   0.0f, -0.161974f,   -0.127306f,   0.0f, -0.159085f,
    -0.128405f,   0.0f, -0.155025f,   -0.127306f,   0.0f, -0.150956f,   -0.124417f,   0.0f, -0.148064f,
    -0.12035f,    0.0f, -0.146963f,   -0.116284f,   0.0f, -0.148064f,   -0.113397f,   0.0f, -0.150956f,
    -0.112299f,   0.0f, -0.155025f,   -0.0260011f,  0.0f, -0.382913f,   -0.0277341f,  0.0f, -0.384646f,
    -0.0301728f,  0.0f, -0.385305f,   -0.032611f,   0.0f, -0.384646f,   -0.0343443f,  0.0f, -0.382911f,
    -0.0350039f,  0.0f, -0.380467f,   -0.0343443f,  0.0f, -0.37803f,    -0.0326112f,  0.0f, -0.3763f,
    -0.0301728f,  0.0f, -0.375641f,   -0.0277341f,  0.0f, -0.3763f,     -0.0260013f,  0.0f, -0.37803f,
    -0.0253419f,  0.0f, -0.380467f,   -0.0839757f,  0.0f, -0.347479f,   -0.0857077f,  0.0f, -0.349209f,
    -0.0881485f,  0.0f, -0.349866f,   -0.0905846f,  0.0f, -0.349209f,   -0.0923189f,  0.0f, -0.347479f,
    -0.0929794f,  0.0f, -0.345042f,   -0.0923187f,  0.0f, -0.342602f,   -0.0905846f,  0.0f, -0.340865f,
    -0.0881485f,  0.0f, -0.340204f,   -0.0857075f,  0.0f, -0.340865f,   -0.0839757f,  0.0f, -0.3426f,
    -0.0833173f,  0.0f, -0.345042f,   -0.175883f,   0.0f, -0.450043f,   -0.177615f,   0.0f, -0.451773f,
    -0.180057f,   0.0f, -0.452431f,   -0.182492f,   0.0f, -0.451773f,   -0.184227f,   0.0f, -0.450042f,
    -0.184888f,   0.0f, -0.447605f,   -0.184227f,   0.0f, -0.445165f,   -0.182492f,   0.0f, -0.44343f,
    -0.180057f,   0.0f, -0.442768f,   -0.177615f,   0.0f, -0.44343f,    -0.175883f,   0.0f, -0.445165f,
    -0.175226f,   0.0f, -0.447605f,   -0.296977f,   0.0f, -0.149422f,   -0.299865f,   0.0f, -0.152312f,
    -0.303928f,   0.0f, -0.153412f,   -0.307994f,   0.0f, -0.152312f,   -0.310884f,   0.0f, -0.149422f,
    -0.311983f,   0.0f, -0.145362f,   -0.310884f,   0.0f, -0.141294f,   -0.307994f,   0.0f, -0.138401f,
    -0.303928f,   0.0f, -0.1373f,     -0.299865f,   0.0f, -0.138401f,   -0.296977f,   0.0f, -0.141294f,
    -0.295878f,   0.0f, -0.145362f,   -0.171149f,   0.0f, -0.179207f,   -0.173458f,   0.0f, -0.18152f,
    -0.176707f,   0.0f, -0.1824f,     -0.179959f,   0.0f, -0.18152f,    -0.182272f,   0.0f, -0.179207f,
    -0.183152f,   0.0f, -0.17595f,    -0.182272f,   0.0f, -0.172702f,   -0.179959f,   0.0f, -0.170392f,
    -0.176707f,   0.0f, -0.169513f,   -0.173458f,   0.0f, -0.170392f,   -0.171149f,   0.0f, -0.172702f,
    -0.17027f,    0.0f, -0.17595f,    -0.384379f,   0.0f, -0.389381f,   -0.38842f,    0.0f, -0.393426f,
    -0.394111f,   0.0f, -0.394967f,   -0.399799f,   0.0f, -0.393426f,   -0.403846f,   0.0f, -0.389379f,
    -0.405386f,   0.0f, -0.383692f,   -0.403846f,   0.0f, -0.378005f,   -0.399799f,   0.0f, -0.373966f,
    -0.394111f,   0.0f, -0.372428f,   -0.38842f,    0.0f, -0.373966f,   -0.384379f,   0.0f, -0.378005f,
    -0.382842f,   0.0f, -0.383692f,   -0.419586f,   0.0f, -0.316104f,   -0.423052f,   0.0f, -0.319571f,
    -0.427931f,   0.0f, -0.32089f,    -0.432807f,   0.0f, -0.319571f,   -0.436273f,   0.0f, -0.316104f,
    -0.437591f,   0.0f, -0.311228f,   -0.436273f,   0.0f, -0.306351f,   -0.432807f,   0.0f, -0.302884f,
    -0.427931f,   0.0f, -0.301565f,   -0.423052f,   0.0f, -0.302884f,   -0.419586f,   0.0f, -0.306351f,
    -0.418267f,   0.0f, -0.311228f,   -0.416361f,   0.0f, -0.0745503f,  -0.419828f,   0.0f, -0.0780161f,
    -0.424705f,   0.0f, -0.0793351f,  -0.429581f,   0.0f, -0.0780162f,  -0.433048f,   0.0f, -0.0745503f,
    -0.434367f,   0.0f, -0.0696729f,  -0.433048f,   0.0f, -0.0647966f,  -0.429581f,   0.0f, -0.0613301f,
    -0.424705f,   0.0f, -0.0600109f,  -0.419828f,   0.0f, -0.0613302f,  -0.416361f,   0.0f, -0.0647966f,
    -0.415042f,   0.0f, -0.0696729f,  -0.454197f,   0.0f, -0.00854038f, -0.458819f,   0.0f, -0.0131636f,
    -0.46532f,    0.0f, -0.014923f,   -0.471823f,   0.0f, -0.0131637f,  -0.476447f,   0.0f, -0.00854038f,
    -0.478207f,   0.0f, -0.00203434f, -0.476446f,   0.0f, 0.0044672f,   -0.471823f,   0.0f, 0.00908446f,
    -0.46532f,    0.0f, 0.0108405f,   -0.458819f,   0.0f, 0.00908432f,  -0.454197f,   0.0f, 0.00446735f,
    -0.452438f,   0.0f, -0.00203434f, 0.00543494f,  0.0f, -0.287576f,   -0.0115117f,  0.0f, -0.304529f,
    -0.0284751f,  0.0f, -0.287576f,   -0.0115117f,  0.0f, -0.270624f,   0.166474f,    0.0f, -0.312352f,
    0.149523f,    0.0f, -0.329303f,   0.132565f,    0.0f, -0.312352f,   0.149523f,    0.0f, -0.295399f,
    -0.0234619f,  0.0f, 0.04688f,     -0.0404085f,  0.0f, 0.0299288f,   -0.0573777f,  0.0f, 0.04688f,
    -0.0404085f,  0.0f, 0.0638428f,   0.346839f,    0.0f, -0.342328f,   0.329888f,    0.0f, -0.35928f,
    0.312925f,    0.0f, -0.342328f,   0.329888f,    0.0f, -0.325375f,   0.323745f,    0.0f, -0.401903f,
    0.313606f,    0.0f, -0.412044f,   0.303465f,    0.0f, -0.401903f,   0.313606f,    0.0f, -0.391776f,
    0.459011f,    0.0f, -0.424454f,   0.448877f,    0.0f, -0.434582f,   0.438742f,    0.0f, -0.424454f,
    0.448877f,    0.0f, -0.414314f,   -0.0337605f,  0.0f, -0.240875f,   -0.0438949f,  0.0f, -0.251003f,
    -0.0540282f,  0.0f, -0.240875f,   -0.0438949f,  0.0f, -0.230736f,   -0.337452f,   0.0f, -0.465977f,
    -0.347586f,   0.0f, -0.476105f,   -0.357725f,   0.0f, -0.465977f,   -0.347586f,   0.0f, -0.455838f,
    -0.205588f,   0.0f, -0.432686f,   -0.215721f,   0.0f, -0.442813f,   -0.225855f,   0.0f, -0.432686f,
    -0.215721f,   0.0f, -0.422546f,   -0.384737f,   0.0f, 0.0192652f,   -0.394871f,   0.0f, 0.00912711f,
    -0.405005f,   0.0f, 0.0192652f,   -0.394871f,   0.0f, 0.0293936f,   -0.351701f,   0.0f, 0.0853256f,
    -0.361836f,   0.0f, 0.0751862f,   -0.371975f,   0.0f, 0.0853256f,   -0.361836f,   0.0f, 0.0954548f,
    -0.465338f,   0.0f, -0.247313f,   -0.475471f,   0.0f, -0.257442f,   -0.485605f,   0.0f, -0.247313f,
    -0.475471f,   0.0f, -0.237173f,   0.0312045f,   0.0f, -0.429291f,   0.0142512f,   0.0f, -0.446243f,
    -0.00270632f, 0.0f, -0.429291f,   0.0142512f,   0.0f, -0.412339f,   -0.453556f,   0.0f, -0.398651f,
    -0.470509f,   0.0f, -0.415614f,   -0.487467f,   0.0f, -0.398651f,   -0.470509f,   0.0f, -0.381699f,
    -0.390709f,   0.0f, -0.145873f,   -0.407662f,   0.0f, -0.162824f,   -0.424619f,   0.0f, -0.145873f,
    -0.407662f,   0.0f, -0.128909f,   -0.129831f,   0.0f, -0.107222f,   -0.146782f,   0.0f, -0.124174f,
    -0.163747f,   0.0f, -0.107222f,   -0.146782f,   0.0f, -0.0902584f,  -0.0605463f,  0.0f, 0.020493f,
    -0.0855938f,  0.0f, -0.00454482f, -0.110647f,   0.0f, 0.020493f,    -0.0855938f,  0.0f, 0.0455528f,
    0.206778f,    0.0f, -0.388539f,   0.18173f,     0.0f, -0.413576f,   0.156676f,    0.0f, -0.388539f,
    0.18173f,     0.0f, -0.36348f,    -0.387814f,   0.0f, 0.0904475f,   -0.412868f,   0.0f, 0.0653993f,
    -0.437916f,   0.0f, 0.0904475f,   -0.412868f,   0.0f, 0.115494f,    0.148253f,    0.0f, 0.0475502f,
    0.094507f,    0.0f, -0.0730075f,  0.239787f,    0.0f, -0.0948718f,  0.216732f,    0.0f, -0.188814f,
    0.221362f,    0.0f, -0.218081f,   0.240875f,    0.0f, -0.229209f,   0.252453f,    0.0f, -0.230969f,
    0.275312f,    0.0f, -0.227368f,   0.286779f,    0.0f, -0.218366f,   0.292548f,    0.0f, -0.206662f,
    0.308031f,    0.0f, -0.173074f,   0.292271f,    0.0f, -0.169385f,   0.302433f,    0.0f, -0.13805f,
    0.284203f,    0.0f, -0.132575f,   0.290845f,    0.0f, -0.102129f,   0.374722f,    0.0f, -0.121687f,
    0.349105f,    0.0f, -0.222703f,   0.342076f,    0.0f, -0.22092f,    0.365873f,    0.0f, -0.127071f,
    0.296364f,    0.0f, -0.110863f,   0.29272f,     0.0f, -0.12756f,    0.31162f,     0.0f, -0.133234f,
    0.301604f,    0.0f, -0.164122f,   0.318337f,    0.0f, -0.168041f,   0.299213f,    0.0f, -0.209529f,
    0.292343f,    0.0f, -0.223344f,   0.278923f,    0.0f, -0.233972f,   0.252402f,    0.0f, -0.238222f,
    0.238487f,    0.0f, -0.236205f,   0.215085f,    0.0f, -0.222825f,   0.209686f,    0.0f, -0.187092f,
    0.230848f,    0.0f, -0.100861f,   0.0840009f,   0.0f, -0.078761f,   0.141628f,    0.0f, 0.0505035f,
    0.377075f,    0.0f, -0.231269f,   0.413797f,    0.0f, -0.0999083f,  0.337872f,    0.0f, -0.066163f,
    0.358711f,    0.0f, 0.0921301f,   0.458515f,    0.0f, 0.0429818f,   0.448168f,    0.0f, 0.232105f,
    0.488337f,    0.0f, 0.246565f,    0.490794f,    0.0f, 0.23974f,     0.455705f,    0.0f, 0.227109f,
    0.466433f,    0.0f, 0.030998f,    0.364582f,    0.0f, 0.0811552f,   0.34577f,     0.0f, -0.0617365f,
    0.42247f,     0.0f, -0.0958248f,  0.384059f,    0.0f, -0.233222f,   0.483383f,    0.0f, 0.260604f,
    0.421037f,    0.0f, 0.263437f,    0.424097f,    0.0f, 0.119515f,    0.176397f,    0.0f, 0.258463f,
    0.161621f,    0.0f, 0.152125f,    0.117714f,    0.0f, 0.153758f,    0.117984f,    0.0f, 0.161005f,
    0.15534f,     0.0f, 0.159617f,    0.170676f,    0.0f, 0.269989f,    0.416578f,    0.0f, 0.132049f,
    0.413621f,    0.0f, 0.271035f,    0.483712f,    0.0f, 0.267849f,    0.17856f,     0.0f, 0.0346214f,
    0.160446f,    0.0f, -0.0396019f,  0.209266f,    0.0f, -0.0397217f,  0.258042f,    0.0f, 0.131398f,
    0.209853f,    0.0f, 0.183321f,    0.184886f,    0.0f, 0.0966602f,   0.114845f,    0.0f, 0.128488f,
    0.117846f,    0.0f, 0.135091f,    0.180241f,    0.0f, 0.106737f,    0.206437f,    0.0f, 0.197663f,
    0.266138f,    0.0f, 0.133338f,    0.214736f,    0.0f, -0.0469872f,  0.151215f,    0.0f, -0.0468319f,
    0.171513f,    0.0f, 0.0363404f,   -0.324866f,   0.0f, 0.216969f,    -0.348295f,   0.0f, 0.271629f,
    -0.104567f,   0.0f, 0.287475f,    -0.118743f,   0.0f, 0.213745f,    -0.154169f,   0.0f, 0.245959f,
    -0.221802f,   0.0f, 0.0591546f,   -0.176713f,   0.0f, 0.0688168f,   -0.196037f,   0.0f, -0.027798f,
    -0.160612f,   0.0f, 0.0913657f,   -0.196037f,   0.0f, 0.0817035f,   -0.144506f,   0.0f, 0.210532f,
    -0.121962f,   0.0f, 0.184768f,    -0.055067f,   0.0f, 0.290694f,    0.0302955f,   0.0f, 0.296239f,
    -0.0994179f,  0.0f, 0.152556f,    -0.154169f,   0.0f, 0.0301667f,   -0.186375f,   0.0f, -0.114761f,
    -0.232062f,   0.0f, -0.0702668f,  -0.26415f,    0.0f, -0.070146f,   -0.28944f,    0.0f, -0.092212f,
    -0.305546f,   0.0f, 0.0366162f,   -0.331309f,   0.0f, 0.120355f,    -0.427931f,   0.0f, 0.236294f,
    -0.427374f,   0.0f, 0.266493f,    -0.374433f,   0.0f, 0.269931f,    -0.324866f,   0.0f, 0.191206f,
    -0.305546f,   0.0f, 0.216969f,    -0.279778f,   0.0f, 0.0849281f,   -0.292658f,   0.0f, 0.245959f,
    -0.277319f,   0.0f, -0.0817912f,  -0.275822f,   0.0f, -0.0804759f,  -0.259226f,   0.0f, -0.0703393f,
    -0.257775f,   0.0f, -0.0703392f,  -0.240941f,   0.0f, -0.070373f,   -0.239491f,   0.0f, -0.0703896f,
    -0.223005f,   0.0f, -0.0792673f,  -0.221602f,   0.0f, -0.0806046f,  -0.206119f,   0.0f, -0.0956258f,
    -0.204715f,   0.0f, -0.0969969f,  -0.5f,        0.0f, 0.5f,         -0.48f,       0.0f, 0.5f,
    0.48f,        0.0f, 0.5f,         0.5f,         0.0f, 0.5f,         -0.5f,        0.0f, 0.48f,
    0.5f,         0.0f, 0.48f,        -0.5f,        0.0f, -0.48f,       0.5f,         0.0f, -0.48f,
    -0.5f,        0.0f, -0.5f,        -0.48f,       0.0f, -0.5f,        0.48f,        0.0f, -0.5f,
    0.5f,         0.0f, -0.5f,
};

int baseFaces[] = {
    91,  0,   1,   1,   2,   3,   3,   4,   5,   5,   6,   7,   3,   5,   7,   7,   8,   9,   9,   10,  11,  7,   9,
    11,  11,  12,  13,  13,  14,  15,  16,  17,  18,  15,  16,  18,  13,  15,  18,  18,  19,  20,  20,  21,  22,  22,
    23,  24,  24,  25,  26,  26,  27,  28,  28,  29,  30,  45,  953, 954, 45,  954, 46,  44,  45,  46,  44,  46,  47,
    43,  44,  47,  43,  47,  48,  42,  43,  48,  42,  48,  49,  41,  42,  49,  41,  49,  50,  40,  41,  50,  40,  50,
    51,  39,  40,  51,  39,  51,  52,  38,  39,  52,  38,  52,  53,  37,  38,  53,  37,  53,  54,  36,  37,  54,  36,
    54,  55,  35,  36,  55,  35,  55,  56,  34,  35,  56,  34,  56,  57,  33,  34,  57,  33,  57,  58,  32,  33,  58,
    32,  58,  59,  31,  32,  59,  31,  59,  60,  30,  31,  60,  30,  60,  61,  28,  30,  61,  28,  61,  62,  28,  62,
    63,  26,  28,  63,  63,  64,  65,  26,  63,  65,  24,  26,  65,  65,  66,  67,  24,  65,  67,  22,  24,  67,  67,
    68,  69,  22,  67,  69,  20,  22,  69,  69,  70,  71,  20,  69,  71,  18,  20,  71,  71,  72,  73,  18,  71,  73,
    13,  18,  73,  73,  74,  75,  75,  76,  77,  73,  75,  77,  77,  78,  79,  79,  80,  81,  77,  79,  81,  81,  82,
    83,  83,  84,  85,  81,  83,  85,  85,  86,  87,  87,  88,  89,  85,  87,  89,  81,  85,  89,  77,  81,  89,  73,
    77,  89,  13,  73,  89,  11,  13,  89,  7,   11,  89,  3,   7,   89,  1,   3,   89,  91,  1,   89,  91,  89,  90,
    177, 92,  93,  93,  94,  95,  95,  96,  97,  97,  98,  99,  95,  97,  99,  99,  100, 101, 101, 102, 103, 99,  101,
    103, 103, 104, 105, 105, 106, 107, 108, 109, 110, 107, 108, 110, 105, 107, 110, 110, 111, 112, 112, 113, 114, 114,
    115, 116, 116, 117, 118, 118, 119, 120, 120, 121, 122, 134, 951, 952, 134, 952, 135, 133, 134, 135, 133, 135, 136,
    132, 133, 136, 132, 136, 137, 131, 132, 137, 131, 137, 138, 130, 131, 138, 130, 138, 139, 129, 130, 139, 129, 139,
    140, 128, 129, 140, 128, 140, 141, 127, 128, 141, 127, 141, 142, 126, 127, 142, 126, 142, 143, 125, 126, 143, 125,
    143, 144, 124, 125, 144, 124, 144, 145, 123, 124, 145, 123, 145, 146, 122, 123, 146, 122, 146, 147, 120, 122, 147,
    120, 147, 148, 120, 148, 149, 118, 120, 149, 149, 150, 151, 118, 149, 151, 116, 118, 151, 151, 152, 153, 116, 151,
    153, 114, 116, 153, 153, 154, 155, 114, 153, 155, 112, 114, 155, 155, 156, 157, 112, 155, 157, 110, 112, 157, 157,
    158, 159, 110, 157, 159, 105, 110, 159, 159, 160, 161, 161, 162, 163, 159, 161, 163, 163, 164, 165, 165, 166, 167,
    163, 165, 167, 167, 168, 169, 169, 170, 171, 167, 169, 171, 171, 172, 173, 173, 174, 175, 171, 173, 175, 167, 171,
    175, 163, 167, 175, 159, 163, 175, 105, 159, 175, 103, 105, 175, 99,  103, 175, 95,  99,  175, 93,  95,  175, 177,
    93,  175, 177, 175, 176, 240, 241, 242, 242, 243, 244, 244, 245, 246, 246, 247, 248, 248, 249, 250, 251, 252, 253,
    250, 251, 253, 253, 254, 255, 250, 253, 255, 255, 256, 257, 257, 258, 259, 259, 260, 261, 261, 262, 263, 263, 264,
    265, 261, 263, 265, 265, 266, 267, 267, 268, 269, 269, 178, 179, 267, 269, 179, 265, 267, 179, 179, 180, 181, 181,
    182, 183, 179, 181, 183, 183, 184, 185, 185, 186, 187, 183, 185, 187, 179, 183, 187, 265, 179, 187, 261, 265, 187,
    259, 261, 187, 257, 259, 187, 187, 188, 189, 189, 190, 191, 187, 189, 191, 257, 187, 191, 255, 257, 191, 250, 255,
    191, 191, 192, 193, 193, 194, 195, 191, 193, 195, 250, 191, 195, 195, 196, 197, 250, 195, 197, 248, 250, 197, 197,
    198, 199, 248, 197, 199, 246, 248, 199, 199, 200, 201, 246, 199, 201, 244, 246, 201, 201, 202, 203, 244, 201, 203,
    242, 244, 203, 203, 204, 205, 242, 203, 205, 240, 242, 205, 205, 206, 207, 240, 205, 207, 239, 240, 207, 239, 207,
    208, 238, 239, 208, 238, 208, 209, 237, 238, 209, 237, 209, 210, 236, 237, 210, 236, 210, 211, 235, 236, 211, 235,
    211, 212, 234, 235, 212, 234, 212, 213, 233, 234, 213, 233, 213, 214, 232, 233, 214, 232, 214, 215, 231, 232, 215,
    231, 215, 216, 230, 231, 216, 230, 216, 217, 229, 230, 217, 229, 217, 218, 228, 229, 218, 228, 218, 219, 227, 228,
    219, 227, 219, 220, 226, 227, 220, 226, 220, 221, 225, 226, 221, 225, 221, 222, 224, 225, 222, 224, 222, 223, 946,
    224, 223, 946, 223, 945, 355, 270, 271, 271, 272, 273, 273, 274, 275, 271, 273, 275, 275, 276, 277, 277, 278, 279,
    275, 277, 279, 271, 275, 279, 279, 280, 281, 281, 282, 283, 279, 281, 283, 283, 284, 285, 285, 286, 287, 283, 285,
    287, 287, 288, 289, 289, 290, 291, 291, 292, 293, 293, 294, 295, 295, 296, 297, 297, 298, 299, 312, 947, 948, 312,
    948, 313, 311, 312, 313, 311, 313, 314, 310, 311, 314, 310, 314, 315, 309, 310, 315, 309, 315, 316, 308, 309, 316,
    308, 316, 317, 307, 308, 317, 307, 317, 318, 306, 307, 318, 306, 318, 319, 305, 306, 319, 305, 319, 320, 304, 305,
    320, 304, 320, 321, 303, 304, 321, 303, 321, 322, 302, 303, 322, 302, 322, 323, 301, 302, 323, 301, 323, 324, 300,
    301, 324, 300, 324, 325, 299, 300, 325, 299, 325, 326, 297, 299, 326, 326, 327, 328, 297, 326, 328, 295, 297, 328,
    328, 329, 330, 295, 328, 330, 293, 295, 330, 330, 331, 332, 293, 330, 332, 291, 293, 332, 332, 333, 334, 291, 332,
    334, 289, 291, 334, 334, 335, 336, 289, 334, 336, 287, 289, 336, 283, 287, 336, 337, 338, 339, 336, 337, 339, 339,
    340, 341, 336, 339, 341, 283, 336, 341, 341, 342, 343, 283, 341, 343, 279, 283, 343, 343, 344, 345, 279, 343, 345,
    345, 346, 347, 279, 345, 347, 347, 348, 349, 349, 350, 351, 347, 349, 351, 279, 347, 351, 271, 279, 351, 351, 352,
    353, 271, 351, 353, 355, 271, 353, 354, 355, 353, 429, 356, 357, 357, 358, 359, 359, 360, 361, 357, 359, 361, 361,
    362, 363, 363, 364, 365, 361, 363, 365, 357, 361, 365, 365, 366, 367, 367, 368, 369, 365, 367, 369, 369, 370, 371,
    371, 372, 373, 369, 371, 373, 373, 374, 375, 375, 376, 377, 377, 378, 379, 379, 380, 381, 381, 382, 383, 383, 384,
    385, 392, 949, 950, 392, 950, 393, 391, 392, 393, 391, 393, 394, 390, 391, 394, 390, 394, 395, 389, 390, 395, 389,
    395, 396, 388, 389, 396, 388, 396, 397, 387, 388, 397, 387, 397, 398, 386, 387, 398, 386, 398, 399, 385, 386, 399,
    385, 399, 400, 383, 385, 400, 400, 401, 402, 383, 400, 402, 381, 383, 402, 402, 403, 404, 381, 402, 404, 379, 381,
    404, 404, 405, 406, 379, 404, 406, 377, 379, 406, 406, 407, 408, 377, 406, 408, 375, 377, 408, 408, 409, 410, 375,
    408, 410, 373, 375, 410, 369, 373, 410, 411, 412, 413, 410, 411, 413, 413, 414, 415, 410, 413, 415, 369, 410, 415,
    415, 416, 417, 369, 415, 417, 365, 369, 417, 417, 418, 419, 365, 417, 419, 419, 420, 421, 365, 419, 421, 421, 422,
    423, 423, 424, 425, 421, 423, 425, 365, 421, 425, 357, 365, 425, 425, 426, 427, 357, 425, 427, 429, 357, 427, 428,
    429, 427, 434, 435, 436, 434, 436, 437, 434, 437, 438, 434, 438, 439, 439, 440, 441, 439, 441, 430, 439, 430, 431,
    439, 431, 432, 439, 432, 433, 434, 439, 433, 446, 447, 448, 446, 448, 449, 446, 449, 450, 446, 450, 451, 451, 452,
    453, 451, 453, 442, 451, 442, 443, 451, 443, 444, 451, 444, 445, 446, 451, 445, 455, 456, 457, 455, 457, 458, 455,
    458, 459, 455, 459, 460, 460, 461, 462, 460, 462, 463, 460, 463, 464, 460, 464, 465, 460, 465, 454, 455, 460, 454,
    470, 471, 472, 477, 466, 467, 476, 477, 467, 475, 476, 467, 474, 475, 467, 473, 474, 467, 472, 473, 467, 472, 467,
    468, 472, 468, 469, 470, 472, 469, 482, 483, 484, 489, 478, 479, 488, 489, 479, 487, 488, 479, 486, 487, 479, 485,
    486, 479, 484, 485, 479, 484, 479, 480, 484, 480, 481, 482, 484, 481, 500, 501, 490, 500, 490, 491, 500, 491, 492,
    500, 492, 493, 493, 494, 495, 493, 495, 496, 493, 496, 497, 493, 497, 498, 493, 498, 499, 500, 493, 499, 512, 513,
    502, 507, 508, 509, 506, 507, 509, 505, 506, 509, 504, 505, 509, 503, 504, 509, 502, 503, 509, 502, 509, 510, 502,
    510, 511, 512, 502, 511, 515, 516, 517, 515, 517, 518, 515, 518, 519, 515, 519, 520, 520, 521, 522, 520, 522, 523,
    520, 523, 524, 520, 524, 525, 520, 525, 514, 515, 520, 514, 530, 531, 532, 530, 532, 533, 530, 533, 534, 530, 534,
    535, 535, 536, 537, 535, 537, 526, 535, 526, 527, 535, 527, 528, 535, 528, 529, 530, 535, 529, 545, 546, 547, 545,
    547, 548, 545, 548, 549, 545, 549, 538, 538, 539, 540, 538, 540, 541, 538, 541, 542, 538, 542, 543, 538, 543, 544,
    545, 538, 544, 557, 558, 559, 552, 553, 554, 551, 552, 554, 550, 551, 554, 561, 550, 554, 560, 561, 554, 559, 560,
    554, 559, 554, 555, 559, 555, 556, 557, 559, 556, 563, 564, 565, 563, 565, 566, 563, 566, 567, 563, 567, 568, 568,
    569, 570, 568, 570, 571, 568, 571, 572, 568, 572, 573, 568, 573, 562, 563, 568, 562, 578, 579, 580, 578, 580, 581,
    578, 581, 582, 578, 582, 583, 583, 584, 585, 583, 585, 574, 583, 574, 575, 583, 575, 576, 583, 576, 577, 578, 583,
    577, 587, 588, 589, 594, 595, 596, 593, 594, 596, 592, 593, 596, 591, 592, 596, 590, 591, 596, 589, 590, 596, 589,
    596, 597, 589, 597, 586, 587, 589, 586, 599, 600, 601, 599, 601, 602, 599, 602, 603, 599, 603, 604, 604, 605, 606,
    604, 606, 607, 604, 607, 608, 604, 608, 609, 604, 609, 598, 599, 604, 598, 617, 618, 619, 617, 619, 620, 617, 620,
    621, 617, 621, 610, 610, 611, 612, 610, 612, 613, 610, 613, 614, 610, 614, 615, 610, 615, 616, 617, 610, 616, 629,
    630, 631, 629, 631, 632, 629, 632, 633, 629, 633, 622, 622, 623, 624, 622, 624, 625, 622, 625, 626, 622, 626, 627,
    622, 627, 628, 629, 622, 628, 635, 636, 637, 635, 637, 638, 635, 638, 639, 635, 639, 640, 640, 641, 642, 640, 642,
    643, 640, 643, 644, 640, 644, 645, 640, 645, 634, 635, 640, 634, 653, 654, 655, 653, 655, 656, 653, 656, 657, 653,
    657, 646, 646, 647, 648, 646, 648, 649, 646, 649, 650, 646, 650, 651, 646, 651, 652, 653, 646, 652, 662, 663, 664,
    662, 664, 665, 662, 665, 666, 662, 666, 667, 667, 668, 669, 667, 669, 658, 667, 658, 659, 667, 659, 660, 667, 660,
    661, 662, 667, 661, 677, 678, 679, 677, 679, 680, 677, 680, 681, 677, 681, 670, 670, 671, 672, 670, 672, 673, 670,
    673, 674, 670, 674, 675, 670, 675, 676, 677, 670, 676, 689, 690, 691, 689, 691, 692, 689, 692, 693, 689, 693, 682,
    682, 683, 684, 682, 684, 685, 682, 685, 686, 682, 686, 687, 682, 687, 688, 689, 682, 688, 701, 702, 703, 701, 703,
    704, 701, 704, 705, 701, 705, 694, 694, 695, 696, 694, 696, 697, 694, 697, 698, 694, 698, 699, 694, 699, 700, 701,
    694, 700, 707, 708, 709, 714, 715, 716, 713, 714, 716, 712, 713, 716, 711, 712, 716, 710, 711, 716, 709, 710, 716,
    709, 716, 717, 709, 717, 706, 707, 709, 706, 722, 723, 724, 722, 724, 725, 722, 725, 726, 722, 726, 727, 727, 728,
    729, 727, 729, 718, 727, 718, 719, 727, 719, 720, 727, 720, 721, 722, 727, 721, 740, 741, 730, 740, 730, 731, 740,
    731, 732, 740, 732, 733, 733, 734, 735, 733, 735, 736, 733, 736, 737, 733, 737, 738, 733, 738, 739, 740, 733, 739,
    752, 753, 742, 752, 742, 743, 752, 743, 744, 752, 744, 745, 745, 746, 747, 745, 747, 748, 745, 748, 749, 745, 749,
    750, 745, 750, 751, 752, 745, 751, 758, 759, 760, 758, 760, 761, 758, 761, 762, 758, 762, 763, 763, 764, 765, 763,
    765, 754, 763, 754, 755, 763, 755, 756, 763, 756, 757, 758, 763, 757, 769, 766, 767, 767, 768, 769, 773, 770, 771,
    771, 772, 773, 777, 774, 775, 775, 776, 777, 781, 778, 779, 779, 780, 781, 785, 782, 783, 783, 784, 785, 786, 787,
    788, 788, 789, 786, 790, 791, 792, 792, 793, 790, 797, 794, 795, 795, 796, 797, 798, 799, 800, 800, 801, 798, 804,
    805, 802, 802, 803, 804, 809, 806, 807, 807, 808, 809, 810, 811, 812, 812, 813, 810, 817, 814, 815, 815, 816, 817,
    820, 821, 818, 818, 819, 820, 822, 823, 824, 824, 825, 822, 829, 826, 827, 827, 828, 829, 830, 831, 832, 832, 833,
    830, 834, 835, 836, 836, 837, 834, 839, 840, 841, 841, 838, 839, 858, 859, 860, 875, 842, 843, 874, 875, 843, 873,
    874, 843, 873, 843, 844, 873, 844, 845, 872, 873, 845, 872, 845, 846, 871, 872, 846, 871, 846, 847, 870, 871, 847,
    870, 847, 848, 869, 870, 848, 869, 848, 849, 868, 869, 849, 868, 849, 850, 867, 868, 850, 867, 850, 851, 866, 867,
    851, 866, 851, 852, 865, 866, 852, 864, 865, 852, 864, 852, 853, 864, 853, 854, 863, 864, 854, 862, 863, 854, 862,
    854, 855, 861, 862, 855, 861, 855, 856, 860, 861, 856, 860, 856, 857, 858, 860, 857, 888, 889, 876, 888, 876, 877,
    882, 883, 884, 881, 882, 884, 880, 881, 884, 880, 884, 885, 880, 885, 886, 879, 880, 886, 879, 886, 887, 878, 879,
    887, 877, 878, 887, 888, 877, 887, 894, 895, 896, 894, 896, 897, 901, 890, 891, 900, 901, 891, 899, 900, 891, 899,
    891, 892, 899, 892, 893, 898, 899, 893, 897, 898, 893, 894, 897, 893, 915, 902, 903, 908, 909, 910, 907, 908, 910,
    906, 907, 910, 906, 910, 911, 905, 906, 911, 905, 911, 912, 904, 905, 912, 904, 912, 913, 903, 904, 913, 903, 913,
    914, 915, 903, 914, 938, 939, 940, 941, 942, 943, 944, 916, 917, 918, 919, 920, 917, 918, 920, 944, 917, 920, 944,
    920, 921, 943, 944, 921, 921, 922, 923, 924, 925, 926, 924, 926, 927, 928, 929, 930, 927, 928, 930, 924, 927, 930,
    924, 930, 931, 923, 924, 931, 923, 931, 932, 923, 932, 933, 923, 933, 934, 921, 923, 934, 934, 935, 936, 921, 934,
    936, 943, 921, 936, 943, 936, 937, 941, 943, 937, 940, 941, 937, 938, 940, 937, 956, 959, 955, 957, 958, 960, 964,
    963, 961, 965, 962, 966,
};

const size_t numBaseVertices = sizeof( baseVertices ) / ( sizeof( float ) * 3 );
const size_t numBaseFaces = sizeof( baseFaces ) / ( sizeof( int ) * 3 );

trimesh3 g_defaultIconMesh;
bool g_isDefaultIconMeshBuilt = false;
} // namespace

void build_icon_mesh( const float* vertices, size_t numVertices, const int* faces, size_t numFaces,
                      trimesh3& outMesh ) {
    outMesh.clear();
    outMesh.set_vertex_count( numBaseVertices + numVertices );

    for( size_t i = 0; i < numBaseVertices; ++i ) {
        outMesh.get_vertex( i ) =
            vector3f( baseVertices[( i * 3 ) + 0], baseVertices[( i * 3 ) + 1], baseVertices[( i * 3 ) + 2] );
    }

    for( size_t i = 0; i < numVertices; ++i ) {
        outMesh.get_vertex( numBaseVertices + i ) =
            vector3f( vertices[( i * 3 ) + 0], vertices[( i * 3 ) + 1], vertices[( i * 3 ) + 2] );
    }

    outMesh.set_face_count( numBaseFaces + numFaces );

    for( size_t i = 0; i < numBaseFaces; ++i ) {
        outMesh.get_face( i ) = vector3( baseFaces[( i * 3 ) + 0], baseFaces[( i * 3 ) + 1], baseFaces[( i * 3 ) + 2] );
    }

    for( size_t i = 0; i < numFaces; ++i ) {
        outMesh.get_face( numBaseFaces + i ) =
            vector3( numBaseVertices + faces[( i * 3 ) + 0], numBaseVertices + faces[( i * 3 ) + 1],
                     numBaseVertices + faces[( i * 3 ) + 2] );
    }
}

const trimesh3& get_default_icon_mesh() {
    if( !g_isDefaultIconMeshBuilt ) {
        g_defaultIconMesh.clear();

        g_defaultIconMesh.add_vertex( -0.5f, 0.0f, -0.5f );
        g_defaultIconMesh.add_vertex( -0.5f, 0.0f, 0.5f );
        g_defaultIconMesh.add_vertex( 0.5f, 0.0f, 0.5f );
        g_defaultIconMesh.add_vertex( 0.5f, 0.0f, -0.5f );

        g_defaultIconMesh.add_face( 0, 1, 2 );
        g_defaultIconMesh.add_face( 0, 2, 3 );

        g_isDefaultIconMeshBuilt = true;
    }

    return g_defaultIconMesh;
}

void gl_draw_trimesh( const frantic::geometry::trimesh3& mesh ) {

    glPushAttrib( GL_CURRENT_BIT );
    glPushClientAttrib( GL_CLIENT_VERTEX_ARRAY_BIT );

    glEnableClientState( GL_VERTEX_ARRAY );

    glBegin( GL_TRIANGLES );

    for( size_t i = 0; i < mesh.face_count(); ++i ) {
        const vector3& face = mesh.get_face( i );

        const vector3f& v0 = mesh.get_vertex( face[0] );
        const vector3f& v1 = mesh.get_vertex( face[1] );
        const vector3f& v2 = mesh.get_vertex( face[2] );
        glVertex3f( v0.x, v0.y, v0.z );
        glVertex3f( v1.x, v1.y, v1.z );
        glVertex3f( v2.x, v2.y, v2.z );
    }

    glEnd();

    /*
    glVertexPointer( 3, GL_FLOAT, 0, &mesh.get_vertex(0)[0] );
    glDrawElements( GL_TRIANGLES, mesh.face_count() * 3, GL_UNSIGNED_INT, &mesh.get_face(0)[0] );
    */

    glPopClientAttrib();
    glPopAttrib();
}
